#pragma once

#include <Windows.h>

template <typename T>
class Singleton
{
protected:
	Singleton() {}
	~Singleton() {}

public:
	static T *getInstance()
	{
		if (_uniqueInstance == NULL)
			_uniqueInstance = new T;
		return (static_cast<T*>(_uniqueInstance));
	}

	static void destroy()
	{
		if (_uniqueInstance != NULL)
		{
			delete _uniqueInstance;
			_uniqueInstance = NULL;
		}
	}

private:
	static T *_uniqueInstance;
};

template <typename T>
T *Singleton<T>::_uniqueInstance = NULL;